package com.mxf.code.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RefreshScope
public class ProviderController {

    @Value("${config.info}")
    private String configInfo;

    @Autowired
    private TestProperties testProperties;

    @GetMapping("/testProperties")
    public TestProperties testProperties(){
        return testProperties;
    }

    @GetMapping("/hi/{id}")
    public String hi(@PathVariable("id") int id) {
        if(id == 1){
            try {
                Thread.sleep(60L);
            }catch (Exception e){

            }
        }
        log.info("301节点");
        return "301";
    }

    @GetMapping("/test/value")
    public String testValue() {
        return configInfo;
    }
}

